package example.fileTest.example1;

import java.io.File;

public class ShowFileSize {
	public static void main(String args[]){
		long size = getFileSize("C:/java.txt");
		System.out.println("File size in bytes: " + size);
	}
	
	public static long getFileSize(String fileName){
		File file = new File(fileName);
		if(!file.exists() || !file.isFile()){
			System.out.println("File doesn\'t exist");
			return -1;
		}
		return file.length();
	}
}
